import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
  {path:'/',redirect:'/home'},
  {path: '/home',name: 'home',component: () => import('../views/Home/home.vue')},
  {path: '/order',name: 'order',component: () => import('../views/Order/order.vue')},
  {path: '/myCenter',name: 'myCenter',component: () => import('../views/MyCenter/myCenter.vue')},
  {path:'/login',name:'login',component: () => import('../views/login/login.vue'),},
  {
    path:'/loginPlus',
    component: () => import('../views/login/loginPlus.vue'),
    children:[
      {
        path:'loginByPhone',
        name:'loginByPhone',
        component: () => import('../views/login/components/loginByPhone.vue')
      },
      {
        path:'loginByPsw',
        name:'loginByPsw',
        component: () => import('../views/login/components/loginByPsw.vue'),
      },
    ],
    redirect:'/loginPlus/loginByPhone'
  },
  {
    path:'/shopDetail/:id',
    name:'shopDetail',
    component: () => import('../views/ShopDetail/shopDetail.vue')
  },
  {
    path:'/cart',
    name:'cart',
    component: () => import('../views/Cart/cart.vue')
  },
  {
    path:'/settings',
    component: () => import('../views/Settings/settings.vue'),
    children:[
      {
        path:'settingHome',
        name:'settingHome',
        meta:{title:'设置',},
        component: () => import('../views/Settings/children/settingHome.vue')
      },
      {
        path:'accountSecurity',
        name:'accountSecurity',
        meta:{title:'账号安全',},
        component: () => import('../views/Settings/children/accountSecurity.vue')
      },
      {
        path:'Authentication',
        name:'Authentication',
        meta:{title:'身份验证'},
        component: () => import('../views/Settings/children/Authentication.vue')
      },
      {
        path:'resetPsw',
        name:'resetPsw',
        meta:{title:'重置密码'},
        component: () => import('../views/Settings/children/resetPsw.vue')
      },
      {
        path:'personalData',
        name:'personalData',
        meta:{title:'个人资料'},
        component: () => import('../views/Settings/children/personalData.vue')
      },
      {
        path:'deliveryAddress',
        name:'deliveryAddress',
        meta:{title:'收货地址',subBtn:'新增地址'},
        component: () => import('../views/Settings/children/deliveryAddress.vue')
      },
    ],
    redirect:'/settings/settingHome'
  },
  {
    path:'/modifyNickname',
    name:'modifyNickname',
    meta:{title:'修改昵称',subBtn:'保存'},
    component: () => import('../views/Settings/children/modifyNicknameProfile.vue')
  },
  {
    path:'/modifyProfile',
    name:'modifyProfile',
    meta:{title:'修改简介',subBtn:'保存'},
    component: () => import('../views/Settings/children/modifyNicknameProfile.vue')
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
